"use strict";
// 定义一个类
var Gretter = /** @class */ (function () {
    function Gretter(msg) {
        this.word = msg;
    }
    Gretter.prototype.greet = function () {
        return 'hello' + this.word;
    };
    return Gretter;
}());
// 实例化Gretter
var gretter = new Gretter('world');
console.log(gretter.greet()); // 'helloworld'
var Clock = /** @class */ (function () {
    function Clock(time) {
        // 接口只描述了类的公共部分
        this.a = '';
        this.currentTime = new Date(time);
    }
    Clock.prototype.getTime = function (format) {
        var years = this.currentTime.getFullYear();
        var month = this.currentTime.getMonth();
        var date = this.currentTime.getDate();
        var hours = this.currentTime.getHours();
        var minutes = this.currentTime.getMinutes();
        var seconds = this.currentTime.getSeconds();
        return years + format[0] + month + format[0] + date + ' ' + hours + format[1] + minutes + format[1] + seconds;
    };
    return Clock;
}());
var date = +new Date();
var clock = new Clock(date);
console.log(clock.getTime(['-', ':'])); // '2020-2-26 21:47:34'
